//最大问题，购物车界面里的数量显示一开始和主菜单一直，但是点击加减按钮后，购物车界面无变化，主菜单有变化。
//修改：在info结构体里面添加了cart_qty_label部件，在qty_btn_event_CB回调函数里面添加了if判断info->cart_qty_label是否存在，如果存在，则写入buf
//在create_tea_item时使info->cart_qty_label 指向 cart_qty_label;
#include"custom_demo.h"
static lv_obj_t *cont;
static lv_obj_t *cont2;
static lv_obj_t *cont3;
static lv_obj_t *shopping_cart;
static lv_obj_t *total_price_label;
static lv_obj_t *paybox_s;
static lv_obj_t *leastonebox;
static lv_obj_t *img;
static lv_obj_t *cart_cont;
static lv_obj_t *cart_qty_label;
static int total_price = 0;
static void update_total_price(int delta);
static void payment_jm(void);
static void lv_payover_s_create(void);
static void lv_pay_least_one_create(void);
static void clear_info_list(void);
static void save_receipt_to_file(const char *filename);
void shopping_cart_jm(void);
static void create_cart_item(lv_obj_t *parent, TeaItemInfo *tmp, int row) ;


static TeaItemInfo *info_list[MAX_ITEMS];
static int item_count = 0;
static void custom_img(void)
{
    img = lv_img_create(lv_scr_act());

    //设置图片源
    LV_IMG_DECLARE(custom_p); /* 声明图片 */
    lv_img_set_src(img, &custom_p); /* 设置图片源 */
}

/*----------------------------------------回调事件---------------------------------------------*/
// 返回按钮事件回调函数  
static void return_btn_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED)
    {
             printf("return user success!\n");
             lv_obj_del(cont); 
             lv_obj_del(img);
             clear_info_list();
             total_price = 0;
             mygui();                                              //系统运行界面
    }
}
// 支付返回按钮事件回调函数  
static void pay_return_btn_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED)
    {
             printf("return shopping UI success!\n");
             lv_obj_del(cont3); 
    }
}

// 支付完成按钮事件回调函数  
static void pay_over_btn_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED && total_price != 0)
    {
        lv_payover_s_create();
        lv_obj_clear_flag(paybox_s,LV_OBJ_FLAG_HIDDEN);
        save_details_to_adminfile("history.txt");
        save_receipt_to_file("receipt.txt");
        for (int i = 0; i < item_count; i++) {
            info_list[i]->qty = 0;
            if (info_list[i]->qty_label != NULL) {
                lv_label_set_text(info_list[i]->qty_label, "0");
            }
        }
        total_price = 0;

        lv_label_set_text(total_price_label,"总计: 0 元");
    }
    else{
        lv_pay_least_one_create();
        lv_obj_clear_flag(leastonebox,LV_OBJ_FLAG_HIDDEN);
        printf("请添加至少一件商品！\n");
    }
}
//购物车图标点击事件
static void shop_btn_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED)
    {
        shopping_cart_jm();
        lv_obj_clear_flag(cart_cont,LV_OBJ_FLAG_HIDDEN);
    }
}
//购物车界面的返回按钮
static void cart_btn_return_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED)
    {
        lv_obj_add_flag(cart_cont,LV_OBJ_FLAG_HIDDEN);
        // lv_obj_del(cart_cont);//删除购物车容器
    }
}

// 加减按钮事件
static void qty_btn_event_cb(lv_event_t *e) {
    lv_event_code_t code = lv_event_get_code(e);
    if (code == LV_EVENT_CLICKED) 
    {
        TeaItemInfo *info = lv_event_get_user_data(e);
        const char *btn_txt = lv_label_get_text(lv_obj_get_child(lv_event_get_target(e), 0));

        if (strcmp(btn_txt, "+") == 0 && info->qty < 99) {
            info->qty++;
            update_total_price(info->price);
        } else if (strcmp(btn_txt, "-") == 0 && info->qty > 0) {
            info->qty--;
            update_total_price(-info->price);
        }
        char buf[8];
        sprintf(buf, "%d", info->qty);
        if (info->qty_label)
            lv_label_set_text(info->qty_label, buf);
        if (info->cart_qty_label)
            lv_label_set_text(info->cart_qty_label, buf);
        
    }
}

/*-----------------------------确认支付按钮事件-----------------------*/

   static void pay_btn_event_cb(lv_event_t *e)
   {
        lv_event_code_t code = lv_event_get_code(e);
        if (code == LV_EVENT_CLICKED)
        {
            payment_jm();
            lv_obj_clear_flag(cont3,LV_OBJ_FLAG_HIDDEN);
        }
   }
/*-------------------------------------主函数区域-------------------------*/
// 添加总金额函数
static void update_total_price(int delta) {
    total_price += delta;
    char buf[32];
    sprintf(buf, "总计: %d 元", total_price);
    lv_label_set_text(total_price_label, buf);
}
//创建奶茶图标和加减按钮
static void create_tea_item(lv_obj_t *parent, TeaNode *tmp, int row, int col) {
    // 1. 创建 item 主框（显示名称、价格、数量）
    lv_obj_t *item = lv_obj_create(parent);
    lv_obj_set_size(item, 170, 120);
    lv_obj_align(item, LV_ALIGN_TOP_LEFT, col * 180 + 10, row * 180 + 10);  // X 间距拉大避免按钮重叠
    lv_obj_set_style_radius(item, 10, 0);
    lv_obj_set_style_bg_color(item, lv_color_hex(0xf5f5f5), 0);
    lv_obj_set_style_border_width(item, 1, 0);

    // 2. 显示名称 + 编号 + 价格
    char text[128];
    sprintf(text, "%s\n编号:%d\n%d元\n数量 ", tmp->name, tmp->id, tmp->price);
    lv_obj_t *label = lv_label_create(item);
    lv_label_set_text(label, text);
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, 5, 5);
    lv_obj_set_style_text_font(label, &lv_font_source_han_sans_bold_14, 0);

    // 3. 数量显示
    TeaItemInfo *info = lv_mem_alloc(sizeof(TeaItemInfo));
    info->qty = 0;
    info->price = tmp->price;
    info->id = tmp->id;
    info->cart_qty_label = cart_qty_label;
    strncpy(info->name, tmp->name, sizeof(info->name));
    info->qty_label = lv_label_create(item);
    lv_label_set_text(info->qty_label, "0");
    lv_obj_align(info->qty_label, LV_ALIGN_BOTTOM_MID, 0, 0);

    // 4. 减按钮（在 item 外，左侧）
    lv_obj_t *btn_dec = lv_btn_create(parent);
    lv_obj_set_size(btn_dec, 30, 30);
    lv_obj_align_to(btn_dec, item, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
    lv_obj_t *dec_label = lv_label_create(btn_dec);
    lv_label_set_text(dec_label, "-");
    lv_obj_center(dec_label);
    lv_obj_add_event_cb(btn_dec, qty_btn_event_cb, LV_EVENT_CLICKED, info);
    lv_obj_set_user_data(btn_dec, info);

    // 5. 加按钮（在 item 外，右侧）
    lv_obj_t *btn_inc = lv_btn_create(parent);
    lv_obj_set_size(btn_inc, 30, 30);
    lv_obj_align_to(btn_inc, item, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 5);
    lv_obj_t *inc_label = lv_label_create(btn_inc);
    lv_label_set_text(inc_label, "+");
    lv_obj_center(inc_label);
    lv_obj_add_event_cb(btn_inc, qty_btn_event_cb, LV_EVENT_CLICKED, info);
    lv_obj_set_user_data(btn_inc, info);

    // 6. 存入 info_list 中
    if (item_count < MAX_ITEMS) {
        info_list[item_count++] = info;
    }
}

/*-----------------------创建确认支付界面---------------------------*/
static void payment_jm(void)
{
cont3 = lv_obj_create(cont);
lv_obj_set_size(cont3,300,250);
lv_obj_set_style_bg_opa(cont3,100,0);
lv_obj_set_style_border_opa(cont3,100,0);
lv_obj_set_style_bg_color(cont3, lv_color_hex(0xffffff), 0);
lv_obj_align(cont3,LV_ALIGN_TOP_MID,0,5);
lv_obj_add_flag(cont3,LV_OBJ_FLAG_HIDDEN);
//-------支付宝图标
lv_obj_t *zf_img = lv_img_create(cont3);
//设置图片源
LV_IMG_DECLARE(zhifubao_p); /* 声明图片 */
lv_img_set_src(zf_img, &zhifubao_p); /* 设置图片源 */
//------vx支付图标
lv_obj_t *vx_img = lv_img_create(cont3);
//设置图片源
LV_IMG_DECLARE(vx_p); /* 声明图片 */
lv_img_set_src(vx_img, &vx_p); /* 设置图片源 */

lv_obj_align(zf_img,LV_ALIGN_TOP_LEFT,10,-10);
lv_obj_align(vx_img,LV_ALIGN_TOP_RIGHT,-10,-10);
    /* ------------创建返回按钮 */
    lv_obj_t * pay_return_btn = lv_btn_create(cont3);
    lv_obj_set_size(pay_return_btn, 70, 50);
    lv_obj_align(pay_return_btn,LV_ALIGN_BOTTOM_MID, 0, 5);
     /*创建按钮标签 */
     lv_obj_t * pay_return_label = lv_label_create(pay_return_btn);
     lv_label_set_text(pay_return_label, "返回");
     lv_obj_set_style_text_font(pay_return_label,&lv_font_source_han_sans_bold_14,0);
     /* 设置按钮事件 */
     lv_obj_add_event_cb(pay_return_btn, pay_return_btn_event_cb, LV_EVENT_CLICKED, NULL);

     /* ----------创建支付按钮 */
    lv_obj_t * pay_over_btn = lv_btn_create(cont3);
    lv_obj_set_size(pay_over_btn, 50, 60);
    lv_obj_align(pay_over_btn,LV_ALIGN_BOTTOM_LEFT, 0, 5);
     /*创建按钮标签 */
     lv_obj_t * pay_over_label = lv_label_create(pay_over_btn);
     lv_label_set_text(pay_over_label, "支付");
     lv_obj_center(pay_over_label);
     lv_obj_set_style_text_font(pay_over_label,&lv_font_source_han_sans_bold_14,0);
     /* 设置按钮事件 */
     lv_obj_add_event_cb(pay_over_btn, pay_over_btn_event_cb, LV_EVENT_CLICKED, NULL);


}

static void clear_info_list(void) {
    for (int i = 0; i < item_count; i++) {
        if (info_list[i]) {
            lv_mem_free(info_list[i]);
            info_list[i] = NULL;
        }
    }
    item_count = 0;
}
/*-----------------------创建一个容器---------------------------*/
static void custom_create(void)
{
    clear_info_list();
    custom_img();
    cont = lv_obj_create(lv_scr_act());
    lv_obj_set_size(cont,650,380);
    lv_obj_set_style_bg_opa(cont,220,0);
    lv_obj_set_style_border_opa(cont,255,0);
    lv_obj_set_style_bg_color(cont, lv_color_hex(0xffffff), 0);
    lv_obj_center(cont);

    /*-----------------------创建一个左下角的购物车按钮---------------------------*/
    /* 创建注册按钮 */
    lv_obj_t * shop_btn = lv_btn_create(cont);
    lv_obj_set_size(shop_btn, 90, 74);
    lv_obj_align(shop_btn,LV_ALIGN_BOTTOM_LEFT, 5, -5);
     /*创建按钮标签 */
     /* 设置按钮透明（背景透明、无边框） */
    lv_obj_set_style_bg_opa(shop_btn, LV_OPA_TRANSP, 0);
    lv_obj_set_style_border_width(shop_btn, 150, 0);
    lv_obj_set_style_shadow_width(shop_btn, 20, 0);

    /*-------------------显示总价格--------------------*/
    total_price_label = lv_label_create(cont);
    lv_obj_set_size(total_price_label, 90, 74);
    lv_obj_align_to(total_price_label,shop_btn,LV_ALIGN_OUT_RIGHT_MID, 5, 0);
    lv_label_set_text(total_price_label,"总计: 0 元");
    lv_obj_set_style_text_font(total_price_label,&lv_font_source_han_sans_bold_14,0);

/* 创建图片对象并居中 */
    //设置图片源
    lv_obj_t *shop_img = lv_img_create(shop_btn);
    LV_IMG_DECLARE(shopcart_p); /* 声明图片 */
    lv_img_set_src(shop_img, &shopcart_p); /* 设置图片源 */
    lv_obj_center(shop_img);
    /* 设置按钮事件 */
    lv_obj_add_event_cb(shop_btn, shop_btn_event_cb, LV_EVENT_CLICKED, NULL);

    /*-----------------------创建一个右下角的返回按钮---------------------------*/
    /* 创建返回按钮 */
    lv_obj_t * return_btn = lv_btn_create(cont);
    lv_obj_set_size(return_btn, 90, 74);
    lv_obj_align(return_btn,LV_ALIGN_BOTTOM_RIGHT, 5, -5);
     /*创建按钮标签 */
    lv_obj_t * return_label = lv_label_create(return_btn);
    lv_label_set_text(return_label, "注销");
    lv_obj_center(return_label);
    lv_obj_set_style_text_font(return_label,&lv_font_source_han_sans_bold_14,0);
    /* 设置按钮事件 */
    lv_obj_add_event_cb(return_btn, return_btn_event_cb, LV_EVENT_CLICKED, NULL);


    /*-----------------------创建底部确认支付按钮---------------------------*/
    /* 创建返回按钮 */
    lv_obj_t * pay_btn = lv_btn_create(cont);
    lv_obj_set_size(pay_btn, 90, 74);
    lv_obj_align(pay_btn,LV_ALIGN_BOTTOM_MID, 5, -5);
     /*创建按钮标签 */
    lv_obj_t * pay_label = lv_label_create(pay_btn);
    lv_label_set_text(pay_label, "确认支付");
    lv_obj_set_style_text_font(pay_label,&lv_font_source_han_sans_bold_14,0);
    lv_obj_center(pay_label);
    /* 设置按钮事件 */
    lv_obj_add_event_cb(pay_btn, pay_btn_event_cb, LV_EVENT_CLICKED, NULL);

    /*-----------------------创建点单界面---------------------------*/
    cont2 = lv_obj_create(cont);
    lv_obj_set_size(cont2,600,250);
    lv_obj_set_style_bg_opa(cont2,100,0);
    lv_obj_set_style_border_opa(cont2,100,0);
    lv_obj_set_style_bg_color(cont2, lv_color_hex(0xffffff), 0);
    lv_obj_align(cont2,LV_ALIGN_TOP_MID,0,5);

    //链表创建对应点餐
    tea_main();
    TeaNode *tmp = head->next;
    int num = 0;
    while (tmp != head) {
        int row = num / 3;
        int col = num % 3;
        create_tea_item(cont2, tmp, row, col);
        tmp = tmp->next;
        num++;
    }

}                   
//-------------------------------支付成功的弹窗------------------------------------
static void lv_payover_s_create(void)
{
    const char buf[128] = {0};
    snprintf(buf,sizeof(buf),"成功支付 %d 元",total_price);
    // static const char  *tips_txt_s={"  注册成功！"};

    paybox_s = lv_msgbox_create(lv_scr_act(),NULL,buf,NULL,true );
    lv_obj_set_style_text_font(paybox_s,&lv_font_source_han_sans_bold_14,0);
    lv_obj_set_size(paybox_s,300,150);
    lv_obj_set_style_bg_opa(paybox_s,200,0);
    lv_obj_align(paybox_s,LV_ALIGN_CENTER,0,50);

    lv_obj_set_style_pad_top(paybox_s,15,LV_STATE_DEFAULT);  //顶部填充
    lv_obj_t *close_btnt = lv_msgbox_get_close_btn(paybox_s); //获取到关闭图标
    lv_obj_set_style_text_color(close_btnt,lv_color_hex(0x696969),LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(close_btnt,&lv_font_montserrat_20,0);
    lv_obj_set_style_pad_top(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_opa(close_btnt,0,LV_STATE_DEFAULT);


    lv_obj_t* msgbox_content = lv_msgbox_get_content(paybox_s); //获取到主体
//    lv_obj_set_style_text_color(msgbox_content,lv_color_hex(0xFF0000),LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(msgbox_content,lv_color_hex(0x808080),LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(msgbox_content,10,LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(msgbox_content,5,0);
    lv_obj_set_style_text_line_space(msgbox_content,10,0);

    lv_obj_add_flag(paybox_s,LV_OBJ_FLAG_HIDDEN);                 //默认隐藏

}

//-------------------------------支付时没有添加货物的弹窗------------------------------------
static void lv_pay_least_one_create(void)
{
    const char *buf = "请添加至少一件商品!";

    leastonebox = lv_msgbox_create(lv_scr_act(),NULL,buf,NULL,true );
    lv_obj_set_style_text_font(leastonebox,&lv_font_source_han_sans_bold_14,0);
    lv_obj_set_size(leastonebox,300,150);
    lv_obj_set_style_bg_opa(leastonebox,200,0);
    lv_obj_align(leastonebox,LV_ALIGN_CENTER,0,50);

    lv_obj_set_style_pad_top(leastonebox,15,LV_STATE_DEFAULT);  //顶部填充
    lv_obj_t *close_btnt = lv_msgbox_get_close_btn(leastonebox); //获取到关闭图标
    lv_obj_set_style_text_color(close_btnt,lv_color_hex(0x696969),LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(close_btnt,&lv_font_montserrat_20,0);
    lv_obj_set_style_pad_top(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(close_btnt,0,LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_opa(close_btnt,0,LV_STATE_DEFAULT);


    lv_obj_t* msgbox_content = lv_msgbox_get_content(leastonebox); //获取到主体
//    lv_obj_set_style_text_color(msgbox_content,lv_color_hex(0xFF0000),LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(msgbox_content,lv_color_hex(0x808080),LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(msgbox_content,10,LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(msgbox_content,5,0);
    lv_obj_set_style_text_line_space(msgbox_content,10,0);

    lv_obj_add_flag(leastonebox,LV_OBJ_FLAG_HIDDEN);                 //默认隐藏

}
static void save_receipt_to_file(const char *filename) {
    FILE *fp = fopen(filename, "wt");
    if (!fp) {
        perror("保存收据失败");
        return;
    }

    fprintf(fp, "\n===== 古茗奶茶购买清单 =====\n");
    for (int i = 0; i < item_count; i++) {
        TeaItemInfo *info = info_list[i];
        if (info->qty > 0) {
            fprintf(fp, "名称: %-10s\t数量: %-10d\t单价: %-10d\t小计: %-10d\n",
                info->name, info->qty, info->price, info->qty * info->price);
        }
    }
    fprintf(fp, "--------------------------\n");
    fprintf(fp, "总计: %d 元\n", total_price);
    fclose(fp);
}

void save_details_to_adminfile(const char *filename)
{
    FILE *fp = fopen(filename, "at");
    if (!fp) {
        perror("保存流水失败");
        return;
    }

    // 获取当前系统时间
    time_t now = time(NULL);
    struct tm *t = localtime(&now);

    // 写入购买时间
    fprintf(fp, "\n===== 古茗奶茶购买历史流水 =====\n");
    fprintf(fp, "购买时间: %04d-%02d-%02d %02d:%02d:%02d\n",
            t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
            t->tm_hour, t->tm_min, t->tm_sec);

    for (int i = 0; i < item_count; i++) {
        TeaItemInfo *info = info_list[i];
        if (info->qty > 0) {
            fprintf(fp, "名称: %s\t数量: %d\t单价: %d\t小计: %d\n",
                info->name, info->qty, info->price, info->qty * info->price);
        }
    }
    fprintf(fp, "--------------------------\n");
    fprintf(fp, "总计: %d 元\n", total_price);
    fclose(fp);
}


/*------购物车界面设计------*/
//购物车里面的商品排版
static void create_cart_item(lv_obj_t *parent, TeaItemInfo *tmp, int row) {
    // 1. 主容器（每项商品一行）
    lv_obj_t *item = lv_obj_create(parent);
    lv_obj_set_size(item, 450, 60);
    lv_obj_align(item, LV_ALIGN_TOP_LEFT, 10, row * 70 + 10); // 每行间隔 70 px
    lv_obj_set_style_radius(item, 10, 0);
    lv_obj_set_style_bg_color(item, lv_color_hex(0xf5f5f5), 0);
    lv_obj_set_style_border_width(item, 1, 0);

    // 2. 减按钮（左侧）
    lv_obj_t *btn_dec = lv_btn_create(item);
    lv_obj_set_size(btn_dec, 40, 40);
    lv_obj_align(btn_dec, LV_ALIGN_LEFT_MID, 10, 0);
    lv_obj_t *dec_label = lv_label_create(btn_dec);
    lv_label_set_text(dec_label, "-");
    lv_obj_center(dec_label);
    lv_obj_add_event_cb(btn_dec, qty_btn_event_cb, LV_EVENT_CLICKED, tmp);
    lv_obj_set_user_data(btn_dec, tmp);

    // 3. 数量标签（中间）
    tmp->cart_qty_label = lv_label_create(item);
    char buf[8];
    sprintf(buf, "%d", tmp->qty);
    lv_label_set_text(tmp->cart_qty_label, buf);
    lv_obj_align(tmp->cart_qty_label, LV_ALIGN_CENTER, 20, 3);
    
    // 4. 加按钮（右侧）
    lv_obj_t *btn_inc = lv_btn_create(item);
    lv_obj_set_size(btn_inc, 40, 40);
    lv_obj_align(btn_inc, LV_ALIGN_RIGHT_MID, -10, 0);
    lv_obj_t *inc_label = lv_label_create(btn_inc);
    lv_label_set_text(inc_label, "+");
    lv_obj_center(inc_label);
    lv_obj_add_event_cb(btn_inc, qty_btn_event_cb, LV_EVENT_CLICKED, tmp);
    lv_obj_set_user_data(btn_inc, tmp);

    // 5. 信息标签（上方靠左）
    lv_obj_t *label = lv_label_create(item);
    char text[128];
    sprintf(text, "%s  编号:%d  %d元", tmp->name, tmp->id, tmp->price);
    lv_label_set_text(label, text);
    lv_obj_align(label, LV_ALIGN_TOP_LEFT, 60, 5);
    lv_obj_set_style_text_font(label, &lv_font_source_han_sans_bold_14, 0);
}

//购物车框架
#if 1
void shopping_cart_jm(void)
{
    int count = 1;
    cart_cont = lv_obj_create(lv_scr_act());
    lv_obj_add_flag(cart_cont,LV_OBJ_FLAG_HIDDEN);
    lv_obj_center(cart_cont);
    lv_obj_set_size(cart_cont,500,300);

    //购物车界面的返回按钮
    lv_obj_t *cart_return_btn = lv_obj_create(cart_cont);
    lv_obj_set_size(cart_return_btn,100,80);
    lv_obj_align(cart_return_btn,LV_ALIGN_TOP_RIGHT,0,0);
    lv_obj_t * cart_return_label = lv_label_create(cart_return_btn);
    lv_label_set_text(cart_return_label, "返回点单界面");
    lv_obj_set_style_text_font(cart_return_label,&lv_font_source_han_sans_bold_14,0);
    lv_obj_center(cart_return_label);
    lv_obj_add_event_cb(cart_return_btn,cart_btn_return_event_cb,LV_EVENT_CLICKED,NULL);

    for (int i = 0; i < item_count; i++)
    {
        
        int row = count;
        if (info_list[i]->qty > 0)
        {
            create_cart_item(cart_cont,info_list[i],row);
            count++;
        }
    }
}
#endif
void custom_demo_jm(void)
{
    custom_create();
}